package org.vergil.core.designpattern.state.Lift;

/**
 * Created by vergil on 17-3-25.
 */
public class StoppingState extends LiftState {

    public StoppingState(LiftState state){
        this.context = state.context;
    }

    public StoppingState(Context context){
        this.context = context;
    }
    @Override
    public void open() {
        context.setLiftState(Context.openningState);
        context.getLiftState().open();
    }

    @Override
    public void close() {

    }

    @Override
    public void run() {
        context.setLiftState(Context.runningState);
        context.getLiftState().run();
    }
    //电梯停止是怎么发生的
    @Override
    public void stop() {
        context.setLiftState(Context.stoppingState);
        System.out.println("电梯停止了...");
    }
}
